<?php
    $_products = $this->getProductCollection();
    $limit_length = 160;
    $_limit = $this->getLimitCount();
    $_n = $_products->getSize();
    if($_limit == "" || $_limit > $_n){
        $_limit = $_n;
    }    
    $_title = $this->getFrontendTitle();
    $_showname = $this->showProductName();
    $_w = $this->getThumbnailWidth();
    $_h = $this->getThumbnailHeight();
    $_showthumb = $this->showThumb();
    $alt_img = $this->getAltImg();
    $_showprice = $this->show_Price();
    $_showlabel = $this->show_Label();
    $_showCart = $this->show_AddtoCart();
    $_showAddto = $this->show_Addto();
?>

<?php if($_limit): ?>
<div class="widget widget-recentreview-products">
    <?php if($_title!=""): ?>
    <div class="widget-title">        
        <h2><span><?php echo $_title; ?></span></h2>
    </div>
    <?php endif; ?>    
    <div class="widget-products">
        <ul class="products-list">
            <?php $i=0; foreach ($_products->getItems() as $_product): ?>
                <li class="<?php if($itemClass = $this->getData('item_class')) echo $itemClass.' ';?>item<?php echo (++$i == count($_products))?' last':''; ?>" style="<?php echo $this->getItemWidth() ? 'width:'.$this->getItemWidth().'px;' : '' ?> <?php echo $this->getItemHeight() ? 'height:'.$this->getItemHeight().'px;' : '' ?> <?php echo $this->getItemSpacing() ? 'margin-right:'.$this->getItemSpacing().'px;margin-bottom:'.$this->getItemSpacing().'px;' : '' ?>">
                    <?php if($_showthumb=="true"): ?>
                        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>" class="product-image">
							<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_w, $_h) ?>" width="<?php echo $_w; ?>" height="<?php echo $_h; ?>" <?php if ($alt_img): ?> 
                                rel="<?php echo $alt_img ?>" 
                                data-alt-src="<?php echo $this->helper('catalog/image')->init($_product, $alt_img)->resize($_w, $_h) ?>"
                                <?php endif ?> alt="<?php echo $this->stripTags($_product->getName(), null, true) ?>" />
							<?php if($_showlabel=="true"):?>
								<?php echo Mage::helper('wishcartsettings')->getLabelProducts($_product->getId()) ?>
							<?php endif; ?>	
						</a>
                    <?php endif; ?>
                    
                    <div class="product-shop">
                        <div class="f-fix">
                            <?php if($_showname=="true"): ?>
                                <h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></a></h3>
                            <?php endif; ?>
                            <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                            <?php if($_showprice=="true"): ?>
                                <?php echo $this->getPriceHtml($_product, true, '-widget-new-list') ?>
                            <?php endif; ?>
                            
                            <?php if($_showCart=="true"): ?>
                                <?php if ($_product->isSaleable()): ?>
                                    <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                                <?php else: ?>
                                    <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                                <?php endif; ?>
                            <?php endif; ?>
                            
                            <?php if($_showAddto=="true"):?>
                            <ul class="add-to-links">
								<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                                    <li><a href="<?php echo $_compareUrl ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('Add to Compare') ?></a></li>
                                <?php endif; ?>
                                <?php if ($this->helper('wishlist')->isAllow()) : ?>
                                    <li><span class="separator">|</span> <a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
                                <?php endif; ?>
                                
                            </ul>
                            <?php endif; ?>
                        </div>
                    </div>
                </li>
            <?php endforeach; ?>
        </ul>
    </div>
</div>
<?php endif; ?>
